<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/jsp/common/taglib.jsp"%>
<script type="text/javascript">
	var list;
	$(function() {
		list = lyGrid({
			pagId : 'paging',
			l_column : [{
				colkey : "name",
				name : "名称",
				isSort : true
			}, {
				colkey : "resurl",
				name : "URL"
			}, {
				colkey : "description",
				name : "描述"
			}, {
				colkey : "id",
				name : "操作",
				renderData : function(rowindex, data, rowdata, colkeyn) {
					var s = '<input type="button" value="删除" onclick="del('+data+');"/>';
					return s;
				}
			} ],
			jsonUrl : '${ctx}/resources/findByPage.shtml',
			checkbox : true,
			serNumber : true
		});
		$("#add").click("click",function(){
			window.open("${ctx}/base/toPage.shtml?page=/system/resources/add");
		})
	})
	function del(id){
		if(window.confirm("删除后不能恢复，确定删除么？")){
			$.ajax({
				url:"${ctx}/resources/del.shtml",
				data:{
					id: id
				},
				type:"post",
				dataType:"json",
				success : function(data){
					if(data){
						loadList();
					}
				}
			})
		}
	}
	function loadList(){
		list.loadData();
		parent.autoHeight();
	}
</script>
<header class="panel-heading">
	<div class="doc-buttons">
		<c:forEach items="${res}" var="key">
			${key.description}
		</c:forEach>
	</div>
</header>
<div class="table-responsive">
	<div id="paging" class="pagclass"></div>
</div>
